<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
cfc('core')->checklogin();
if($_RQ['op']=='main'){
	$return['list']=array();
	$return['credit_types']=array('获得','扣除');
	$return['params']['type']=intval($_RQ['type']);
	set_html('title','在线问诊');
	exi($return);
}
if($_RQ['op']=='list'){	
	$params=array('uniacid'=>$_SESSION['uniacid'],'ispay'=>1,'mid'=>$_SESSION['uid']);
	$type=intval($_RQ['type']);
	if($type==1){
		$params['day <>']=date('Y-m-d');
	}else if($type==2){
		$params['ispay']=0;
	}else{
		$params['day']=date('Y-m-d');
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=$this->pdo_getslice('linelog',$params,array($pindex,$psize),$total,'','','id desc');
	if($list){
		foreach($list as &$item){
			$item['createtime']=date('Y/m/d H:i:s',$item['createtime']);
			$item['is_addtitle']=$item['ispay']?'已支付':'未支付';
			$item['typetitle']=$credit_types[$item['feetype']];
			$item['worker']=pdo_get('jy_zhongyi_worker',array('uniacid'=>$_SESSION['uniacid'],'id'=>$item['worker_id']),array('lesson_id','storeid','name'));
		}
	}
	$return['list']=$list;
	exi($return);
}
if($_RQ['op']=='pay'){
	$id = intval($_RQ['id']);
	if(!$id){
		exi('订单不存在，请重新选择订单','error');
	}
	$order=pdo_get('jy_zhongyi_linelog',array('uniacid'=>$_SESSION['uniacid'],'id'=>$id));
	exi($order['pay_id']);
}